﻿using System;
using HttpContrib;
using Microsoft.Scripting.Hosting;
using TMShopClient.Interface;

// Test change
namespace Tavis.Scripting {
    class PythonScript : IScript {

        private readonly ScriptEngine _Engine;
        private readonly ScriptScope _ScriptScope;
        private readonly ScriptSource _Source;
        public Action Init { get; set;}

        public PythonScript(string script) {
            _Engine = IronPython.Hosting.Python.CreateEngine();
            _ScriptScope = _Engine.CreateScope();
            _ScriptScope.SetVariable("Host", this);
            _Source = _Engine.CreateScriptSourceFromString(script);
            _Source.Execute(_ScriptScope);
            
        }

        public void OnInit() {
            if (Init != null) Init();
        }

        public void OnResourceChange(IHypermediaContent resource) {
            
        }

        public void OnCommand(Command command) {
            
        }

        public void OnDeactivate() {
            
        }
    }


}
